package com.xiaozhichao.nosql.mongodb;

import com.mongodb.MongoClient;
import com.mongodb.client.MongoDatabase;

/**
 * @author:xiaozhichao
 * @date:2019/1/12
 */
public class Connection {
    public static void main(String[] args) {
        MongoClient client = new MongoClient("localhost",27017);
        MongoDatabase test = client.getDatabase("test");
        if(test != null){
            System.out.println("连接mongodb成功");
        }
        //...
    }
}
